#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+1000;
typedef long long LL;
typedef pair<int,int>P;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
P a[maxn];
int suf[maxn];
bool cmp(P A,P B)
{
    if(A.first==B.first) return A.second<B.second;
    return A.first<B.first;
}
int numberOfWeakCharacters(vector<vector<int>>& pr) {
    int n=pr.size();
    for(int i=0;i<pr.size();i++)
    {
        a[i+1].first=pr[i][0];
        a[i+1].second=pr[i][1];
    }
    sort(a+1,a+1+n);
    for(int i=0;i<maxn-10;i++) suf[i]=0;
    for(int i=n;i>=1;i--)
    {
        suf[i]=max(suf[i+1],a[i].second);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        int g=pr[i][0];
        P res={g,INT_MAX};
        int pos=upper_bound(a+1,a+1+n,res)-a;
        if(suf[pos]>pr[i][1])
        {
            ans++;
        }
    }
    return ans;
}
int main(void){


   	return 0;
}
